let allowed = "zxh";
let words = ["zxh", "zxh", "zxh", "123", "23", "65"]


function main(allowed: string, words: string[]) {
    let count = 0
    words.forEach((item, index) => {
        if (item === allowed) {
            count++
        } 
    })
    return count
     

}
console.log(main(allowed,words));

let url = 'http: //example.com/index.html?a=1&b=2&c=3&d ';

function copy(url:string){
      
    let parstr=url.split("?")[1]
    let parArr = parstr.split('&');
    // console.log(parstr);
    // console.log(parArr);
    let obj={}
    parArr.forEach((item:string)=>{
        let key = item.split('=')[0]
        let value=item.split("=")[1]
        if(value==undefined){
            value="ture"
        }
        let newobj={
            [key]:value
        }
      obj=Object.assign(Object.assign({}, obj), newobj)
        
        
        
    })
    console.log(obj);
    
    return obj
}
copy(url)
function func(arr: number[]): number {
    let num = 0;
    for (let i = 0; i < arr.length; i++) {
        let dif = arr[i + 1] - arr[i]
        if (dif > 0) {
            num += dif
        }
    }
    return num
}
console.log(func([7, 1, 5, 3, 6, 4]), '买卖股票的最佳时机');

/* function erwei(arr:Array<Array<any>>):Array<number>{
       let str=[]
       str=arr.flat()
    return str
}

erwei([[[1,2],1,2,3],[2,3,4]]) */

interface MYPARAMS{
      age:number,
      name:string
}
class Greeter{
    greeting:string;
    age:number
    setDate:(can:number)=>void
    constructor(message:string,age?:number){
      this.greeting=message;
      this.age=age as number
     
      this.setDate=(can)=>{
         console.log(can);
         
      }
    }
    
  
    getlist(params:MYPARAMS){

    }
}

console.log(Greeter);
